The final command requires us to look at the entire network, not just one or two users.
Guidance for Step 4
- `count_greater x`: Count how many users have a degree strictly greater than `x`.
-
Algorithm:
- Initialize `count = 0`.
- Loop through every user `i` from `0` to `U-1`.
- For each user, get their degree.
- If `degree > x`, increment `count`.
- Print the final `count`.
- Your Task: Fill in the blanks to complete the final command.
...
elif op == "count_greater":
x = int(parts[1])
count = 0
# --- BLANK 5 ---
# We must iterate through all U users.
for i in _____________:
# --- BLANK 6 ---
# Get the degree of user i and check if it's > x.
if _______________ > x:
count += 1
print(f"{count}")
Copied!